//
//  CubeSettingPlugin.m
//  Module
//
//  Created by Fanty on 14-1-3.
//  Copyright (c) 2014年 Fanty. All rights reserved.
//

#import "CubeSettingPlugin.h"
#import "ApiConstant+Cube.h"
#import "DataCenter+Cube.h"

@implementation CubeSettingPlugin

-(void)getAppInfo:(CDVInvokedUrlCommand*)command{
    NSString* callbackId=command.callbackId;

    NSMutableString* json=[[NSMutableString alloc] initWithCapacity:5];
    [json appendString:@"{"];
    [json appendFormat:@"\"%@\":\"%@\",",@"appId",[[NSBundle mainBundle] bundleIdentifier]];
    [json appendFormat:@"\"%@\":\"%@\",",@"appKey",[ApiConstant defaultConstant].appKey];
    [json appendFormat:@"\"%@\":\"%@\",",@"sessionKey",[DataCenter defaultCenter].appToken];
    [json appendFormat:@"\"%@\":\"%@\",",@"loginUrl",[[[ApiConstant defaultConstant] loginURL] absoluteString]];
    [json appendFormat:@"\"%@\":\"%@\"",@"logoutUrl",[[[ApiConstant defaultConstant] logoutURL] absoluteString]];

    [json appendString:@"}"];


    CDVPluginResult*pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:json];
    
    [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
        
}


@end
